<template>
  <div class="URadio">
    <el-radio-group
      :value="formValue"
      @input="input"
      v-bind="$attrs"
    >
      <el-radio
        v-for="option in $attrs.options || []"
        :key="option.value"
        :label="option.value"
      >
        {{ option.label }}
      </el-radio>
    </el-radio-group>
  </div>
</template>

<script>
export default {
  name: 'URadio',
  props: {
    formValue: {
      type: String | Number,
      default: () => ''
    }
  },
  methods: {
    input(val) {
      this.$emit('update:formValue', val);
      this.$emit('change', val);
    }
  }
};
</script>

<style lang="scss" scoped>
</style>
